--[[	$Id: garbage.lua 3391 2013-07-10 07:10:35Z sdkyron@gmail.com $	]]

local _, caelCore = ...

caelCore.garbage = caelCore.createModule("Garbage")

local eventCount = 0
caelCore.garbage:RegisterAllEvents()
caelCore.garbage:HookScript("OnEvent", function(self, event)
	eventCount = eventCount + 1

	if InCombatLockdown() then return end

	if eventCount > 10000 or event == "PLAYER_ENTERING_WORLD" then
		collectgarbage("collect")
		eventCount = 0
	end
end)